package com.springframework.beans.factory.config;

import com.springframework.beans.MyBeanMetadataElement;
import com.springframework.beans.MyMutablePropertyValues;
import com.springframework.core.MyAttributeAccessor;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.lang.Nullable;

/**
 * @Author 虎哥
 * @Description 定义一个 Bean 的元信息
 * 要带着问题去学习,多猜想多验证
 **/
public interface MyBeanDefinition extends MyAttributeAccessor, MyBeanMetadataElement {
    @Nullable
    String getBeanClassName();
    boolean isPrototype();
    @Nullable
    String getParentName();
    String SCOPE_PROTOTYPE = ConfigurableBeanFactory.SCOPE_PROTOTYPE;
    @Nullable
    String getFactoryBeanName();
    boolean isAbstract();
    @Nullable
    String getFactoryMethodName();
    default boolean hasConstructorArgumentValues() {
        return !getConstructorArgumentValues().isEmpty();
    }
    default boolean hasPropertyValues() {
        return !getPropertyValues().isEmpty();
    }
    @Nullable
    String[] getDependsOn();
    @Nullable
    String getInitMethodName();
    void setBeanClassName(@Nullable String beanClassName);
    @Nullable
    String getDestroyMethodName();
    boolean isLazyInit();
    boolean isSingleton();
    void setParentName(@Nullable String parentName);

    void setScope(@Nullable String scope);

    void setLazyInit(boolean lazyInit);

    void setDependsOn(@Nullable String... dependsOn);

    void setAutowireCandidate(boolean autowireCandidate);

    void setPrimary(boolean primary);

    void setInitMethodName(@Nullable String initMethodName);

    void setDestroyMethodName(@Nullable String destroyMethodName);

    void setFactoryMethodName(@Nullable String factoryMethodName);
    void setFactoryBeanName(@Nullable String factoryBeanName);
    @Nullable
    String getScope();
    int getRole();
    boolean isPrimary();
    boolean isAutowireCandidate();

    void setDescription(@Nullable String description);

    ConstructorArgumentValues getConstructorArgumentValues();

    MyMutablePropertyValues getPropertyValues();

    void setRole(int role);
    @Nullable
    MyBeanDefinition getOriginatingBeanDefinition();

    @Nullable
    String getResourceDescription();
}

